﻿using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Web.Script.Serialization;
using System.Web.UI;

namespace Web.Library.DomainObject.SQLServer
{
    public partial class AuthInfo
    {
        private int _id;
        //private string _fullname;
        private string _emailaddress;
        private int _groupid;
        private int _groupappid;
        //private bool _ho;
        private List<Dictionary<string, Dictionary<string, string>>> _menuauthorization;

        public int ID
        {
            get
            {
                return this._id;
            }
            set
            {
                this._id = value;
            }
        }

        //public string Fullname
        //{
        //    get
        //    {
        //        return this._fullname;
        //    }
        //    set
        //    {
        //        this._fullname = value;
        //    }
        //}

        public string EmailAddress
        {
            get
            {
                return this._emailaddress;
            }
            set
            {
                this._emailaddress = value;
            }
        }

        public int GroupID
        {
            get
            {
                return this._groupid;
            }
            set
            {
                this._groupid = value;
            }
        }

        public int GroupAppID
        {
            get
            {
                return this._groupappid;
            }
            set
            {
                this._groupappid = value;
            }
        }

        //public int BranchID
        //{
        //    get
        //    {
        //        return this._branchid;
        //    }
        //    set
        //    {
        //        this._branchid = value;
        //    }
        //}

        //public bool HO
        //{
        //    get
        //    {
        //        return this._ho;
        //    }
        //    set
        //    {
        //        this._ho = value;
        //    }
        //}

        public List<Dictionary<string, Dictionary<string, string>>> MenuAuthorization
        {
            get
            {
                return this._menuauthorization;
            }
            set
            {
                this._menuauthorization = value;
            }
        }

        public AuthInfo UserInfo()
        {
            return new JavaScriptSerializer().Deserialize<AuthInfo>(new Page().User.Identity.Name);
        }
    }
}
